## GroundEnemyIdle
class_name GroundEnemyIdle
extends GroundEnemyBase


export (float, 0.0, 100.0, 0.1) var min_time : float = 1.0
export (float, 0.0, 100.0, 0.1) var max_time : float = 5.0


var _idle_timer : Timer = create_timer()


#(override)
func enter():
	if not _idle_timer.is_inside_tree():
		yield(_idle_timer, "ready")
	_idle_timer.start(rand_range(1, 5))


#(override)
func state_process(_arg0):
	if has_player():
		switch_to(GroundEnemyStateBlackboard.States.ATTACK)
	
	elif _idle_timer.time_left <= 0:
		set_data("move_forward", true)
		switch_to(GroundEnemyStateBlackboard.States.MOVE)


